<?php

namespace app\erp\controller;

use app\erp\model\Yujingdb;

class Yujing extends Base {
	protected $db;
	protected $cols = array (
			array (
					'field' => 'order_no',
					'width' => 200,
					'title' => '订单号',
					'fixed' => 'left'
			),
			array (
					'field' => 'out_order_no',
					'width' => 200,
					'title' => '军采订单号',
					'fixed' => 'left'
			),
        array (
            'field' => 'gongyingshang',
            'width' => 160,
            'title' => '供应商',
            'fixed' => 'left'
        ),
        array (
            'field' => 'yewuyuan',
            'width' => 120,
            'title' => '业务员',
            'fixed' => 'left'
        ),
			array (
					'field' => 'yujing_text',
					'width' => 120,
					'title' => '预警',
					'fixed' => 'left'
			),
			array (
					'field' => 'chaoshi_text',
					'width' => 120,
					'title' => '超时',
					'fixed' => 'left'
			),
			array (
					'field' => 'create_time',
					'width' => 160,
					'title' => '下单' 
			),
			array (
					'field' => 'push_supplier_time',
					'width' => 160,
					'title' => '指定供应商' 
			),
			array (
					'field' => 'supplier_confirm_time',
					'width' => 160,
					'title' => '确认订单' 
			),
			array (
					'field' => 'gys_fh_time',
					'width' => 160,
					'title' => '供应商发货' 
			),
			array (
					'field' => 'gys_sh_time',
					'width' => 160,
					'title' => '供应商收货' 
			),
			array (
					'field' => 'caigou_invoice_time',
					'width' => 160,
					'title' => '采购发票' 
			),
			array (
					'field' => 'caigou_hetong_time',
					'width' => 160,
					'title' => '上传合同' 
			),
			array (
					'field' => 'jc_fh_time',
					'width' => 160,
					'title' => '军采发货' 
			),
			array (
					'field' => 'jc_sh_time',
					'width' => 160,
					'title' => '军采收货' 
			),
			array (
					'field' => 'invoice_time',
					'width' => 160,
					'title' => '销售发票' 
			),
			array (
					'field' => 'audit_caigou_invoice_time',
					'width' => 160,
					'title' => '审核发票' 
			),
			array (
					'field' => 'pay_time',
					'width' => 160,
					'title' => '收款时间' 
			),
			array (
					'field' => 'ghs_pay_time',
					'width' => 160,
					'title' => '付款时间' 
			) 
	);
	public $post = array ();
	public function _initialize() {
		parent::_initialize ();
		$request = request ();
		$param = $request->param ();
		$this->post = $param;
		$this->db = new Yujingdb ();
	}
	public function index() {
		$this->assign ( 'yujing_cols', json_encode ( $this->cols ) );
		return $this->fetch ();
	}
	/**
	 *
	 * @todo 列表
	 */
	public function ajaxList() {
		$this->db->param = $this->post;
		$return = $this->db->ajaxSelect ();
		$this->layuiReturn ( $return ['data'], $return ['count'] );
	}
}